﻿using Microsoft.EntityFrameworkCore.Storage;

namespace EasyDDD.Infrastructure.EFCore.Repository
{
    public interface IUnitOfWork : IDisposable
    {
        IDbContextTransaction? CurrentTransaction { get; }
        IDbContextTransaction BeginTransaction();
        Task CommitAsync(CancellationToken cancellationToken);
        Task RollbackAsync(CancellationToken cancellationToken);
        Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
        Task<int> SaveUnitOfWorkAsync(CancellationToken cancellationToken = default);
    }
}
